package com.tous.translate;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;

import javax.net.ssl.HttpsURLConnection;

public class Test {

	public static void main(String[] args) throws IOException {
		
		
		String httpsURL = "https://translate.google.com/#auto/fr/hello";
	    URL myurl = new URL(httpsURL);
	    HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
	    InputStream ins = con.getInputStream();
	    InputStreamReader isr = new InputStreamReader(ins);
	    BufferedReader in = new BufferedReader(isr);
	 
	    String inputLine;
	 
	    while ((inputLine = in.readLine()) != null)
	    {
	      System.out.println(inputLine);
	    }
	 
	    in.close();
	  }
		/*String val = "Officers kill armed suspect in St. Louis suburb, police say";
		String url = "https://translate.google.com/#auto/fr/hello";

		
		URL myURL = new URL(url);
		HttpsURLConnection conn = (HttpsURLConnection) myURL.openConnection();

		conn.setRequestMethod("GET");

		Scanner scanner;
		String response = null;
		if (conn.getResponseCode() != 200) {
			scanner = new Scanner(conn.getErrorStream());
			response = "Error From Server \n\n";
		} else {
			scanner = new Scanner(conn.getInputStream());
			response = "Response From Server \n\n";
		}
		scanner.useDelimiter("\\Z");
		response = scanner.next();
		scanner.close();
		conn.disconnect();

	}*/

}
